package com.eleadmin.order.controller;

import com.eleadmin.common.core.web.BaseController;
import com.eleadmin.common.core.web.JsonResult;
import com.eleadmin.order.entity.ContainerBill;
import com.eleadmin.order.service.ContainerBillService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;


/**
 *
 * 拖车运单
 * @author : Doman
 * @date : 2023-01-13 11:14:35
 * @version ：1.0
 */

@Api(tags = "拖车运单")
@RestController
@RequestMapping("/api/order/dashBoard")
public class DashBoardController extends BaseController {

    @Autowired
    private ContainerBillService containerBillService;

    @PreAuthorize("hasAuthority('order:containerBill:list')")
    @ApiOperation(value = "返回每天订单条数",notes = "" +
            "date1  做箱()开始时间 比如2020-10-10 00:00:00\n" +
            "date2  做箱()结束时间 比如2020-10-10 23:59:59\n" +
            "")
    @GetMapping("/listDayNum")
    public JsonResult listDayNum(ContainerBill containerBill) throws Exception{
        return containerBillService.listDayNum(containerBill);
    }

    @PreAuthorize("hasAuthority('order:containerBill:list')")
    @ApiOperation(value = "返回每月订单条数",notes = "" +
            "customer  填1 就表示要返回货代字段 具体的客户就返回单个客户的数量 \n" +
            "date1  做箱()开始时间 比如2020-10-10\n" +
            "")
    @GetMapping("/listMonthNum")
    public JsonResult listMonthNum(ContainerBill containerBill) throws Exception{
        return containerBillService.listMonthNum(containerBill);
    }

    @PreAuthorize("hasAuthority('order:containerBill:list')")
    @ApiOperation(value = "本周本月热门门点",notes = "" +
            "dock  week  本周排行\n" +
            "dock  month  本月排行\n" +
            "dock  last month  上月排行\n" +
            "dock  quarter  本季排行\n" +
            "dock  last quarter  上季排行\n" +
            "dock  customer  返回客户,需要填下面的customer和具体的客户名称\n" +
            "customer  具体的客户名称\n" +
            "返回的结果:\n" +
            "customer 口岸\n" +
            "factoryAddress 地址\n" +
            "num 数量\n" +
            "boxType 箱型\n" +
            "price 价格n" +
            "")
    @GetMapping("/listDockNum")
    public JsonResult listDockNum(ContainerBill containerBill) throws Exception{
        return containerBillService.listDockNum(containerBill);
    }

    @PreAuthorize("hasAuthority('order:containerBill:list')")
    @ApiOperation(value = "返回每月订单客户或者司机条数",notes = "" +
            "customer  填1 就表示要返回货代字段\n" +
            "carNo  填1 就表示要返回货代字段\n" +
            "date1  做箱开始时间 填2020-10-01\n" +
            "返回的结果:\n" +
            "nums 数量\n" +
            "")
    @GetMapping("/listCustomerAndDriverNum")
    public JsonResult listCustomerAndDriverNum(ContainerBill containerBill) throws Exception{
        return containerBillService.listCustomerAndDriverNum(containerBill);
    }

    @PreAuthorize("hasAuthority('order:containerBill:list')")
    @ApiOperation(value = "日历返回订单数量",notes = "" +
            "customer  客户\n" +
            "driverPhone  司机电话\n" +
            "carTeamId  车队id\n" +
            "date1  做箱(pack_date)开始时间 比如2020-10-10 12:00:00\n" +
            "date2  做箱(pack_date)结束时间 比如2020-10-10 14:00:00\n" +
            "返回的结果:\n" +
            "boxNum 数量\n" +
            "pack_date varchar 装箱日期(货代要求的装箱时间)\n" +
            "")
    @GetMapping("/calendarBillNum")
    public JsonResult calendarBillNum(ContainerBill containerBill) throws Exception{
        return containerBillService.calendarBillNum(containerBill);
    }

}
